let dialog = {
    getMsgName(args) {
        return `dialog_${args.callee.name}`
    },
    async openFile(param) {
        let msgName = this.getMsgName(arguments);
        let resultStr = await native.call(msgName, JSON.stringify(param));
        return JSON.parse(resultStr);
    },
    async openFolder(param) {
        let msgName = this.getMsgName(arguments);
        let resultStr = await native.call(msgName, JSON.stringify(param));
        return JSON.parse(resultStr);
    }
}
let fileOpenBtn = document.querySelector("#fileOpenBtn");
fileOpenBtn.addEventListener("click", async () => {
    let param = {
        title: "这是打开文件对话框的标题",
        defaultPath: "C:\\Program Files",
        filters: ['image/*', 'text/*'],
        multiSelections: true,
        filterIndex: 1
    }
    let files = await dialog.openFile(param);
    console.log(files);
})
let dirOpneBtn = document.querySelector("#dirOpenBtn");
dirOpneBtn.addEventListener("click", async () => {
    let param = {
        title: "这是打开文件夹对话框的标题",
        defaultPath: "C:\\Program Files",
    }
    let files = await dialog.openFolder(param);
    console.log(files);
})